/**
 * Created by showtan on 2018/12/27.
 * 消息详情
 */


class MessageDetail extends Component {
  static navigationOptions = ({ navigation }) => ({
    title: '消息详情'
  });
  constructor(props) {
    super(props);
    this.state = {
    }
  }
  componentDidMount() {
    this.props.dispatch({ type: 'task/changeNum', payload: { num: 0 } });
  }
  render() {
    let detail = [
      { name: '消息名称', value: '更新软件' },
      { name: '内容', value: 'APP已有最新版本，请及时更新、反馈' },
      { name: '发布时间', value: '2016-06-07 14：39：44' },
      { name: '发布人', value: '刘大帅' }
    ]
    return (
      <View style={styles.container}>
        <ScrollView showsVerticalScrollIndicator={false} style={styles.container1}>
          {
            detail.map((item, index) => {
              return (
                <View key={index} style={[styles.itemCell, index == 0 && { marginTop: adapt(20) }, index == 3 && { borderBottomWidth: 0 }]}>
                  <Text style={{ color: '#444', fontSize: adapt(16) }}>{item.name}:</Text>
                  <Text style={[{ color: '#6e6e6e', marginTop: adapt(4) }, index == 5 && { color: 'blue', textDecorationLine: 'underline' }]}>{item.value}</Text>
                </View>
              )
            })
          }
        </ScrollView>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#ededed'
  },
  container1: {
    flex: 1,
    backgroundColor: '#fff'
  },
  itemCell: {
    height: adapt(70),
    marginHorizontal: adapt(25),
    justifyContent: 'center',
    borderBottomWidth: adapt(1),
    borderColor: '#ddd'
  },
  bottomCell: {
    width: width,
    bottom: 0,
    height: isIphoneX() ? adapt(80) : adapt(50),
    backgroundColor: '#00c2ef',
    alignItems: 'center'
  }
});

MessageDetail.proptypes = {
  task: PropTypes.object,
  dispatch: PropTypes.func
}

function mapStateToProps({ task }) {
  return { task }
}

export default connect(mapStateToProps)(MessageDetail)
